from apps.common.base.serializers import *
from apps.education.section.models import *


class SectionBaseSerializer(BaseSerializer):
    class Meta:
        model = Section
        fields = "__all__"


class SectionModelSerializer(SectionBaseSerializer):

    parentName = serializers.SerializerMethodField()
    def get_parentName(self, obj):
        return obj.parent.name + ' ' + obj.parent.title if obj.parent else ''
    
    label = serializers.SerializerMethodField()
    def get_label(self, obj):
        return obj.name + ' ' + obj.title

    class Meta:
        model = Section
        fields = "__all__"
